package com.wonders.framework.auto.builder.code.convert.instance;

import com.wonders.framework.auto.builder.code.convert.BaseTagConvert;
import com.wonders.framework.auto.builder.code.entity.vo.BuildTable;

/**
 * 日期标签转换器
 * 
 * @author WuBin
 * 
 */
public class HasDateConvert extends BaseTagConvert {

	public String convert(String str, String tag, BuildTable buildTable) {
		if (buildTable.isHasDate()) {
			if ("#entity-hasDate#".equals(tag)) {
				str = "\n" + str;
				str = str.replace(tag, "import java.util.Date;");
				str += "\n";
			} else {
				str = str.replace(tag, "\n"
						+ "import com.wonders.framework.util.DateUtil;");
			}
		} else {
			str = str.replace(tag, "");
		}
		return str;
	}

}
